﻿package com.company;
public class Main {
    public static void main(String[] args) {
        SwordsMan swordsMan = new SwordsMan();
        swordsMan.setName("Justin");
        swordsMan.setLevel(1);
        swordsMan.setBlood(200);

        Magician magician = new Magician();
        magician.setName("Monica");
        magician.setLevel(1);
        magician.setBlood(100);

        drawfight(swordsMan);
        drawfight(magician);//调用的实际上是个别子类上的方法
    }
    static void drawfight(Role role){
        System.out.print(role.getName());
        role.fight();
    }
}